import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RechargeRecordVO, RechargeRecordForm, RechargeRecordQuery } from '@/api/retail/rechargeRecord/types';

/**
 * 查询充值记录列表
 * @param query
 * @returns {*}
 */

export const listRechargeRecord = (query?: RechargeRecordQuery): AxiosPromise<RechargeRecordVO[]> => {
  return request({
    url: '/retail/rechargeRecord/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询充值记录详细
 * @param id
 */
export const getRechargeRecord = (id: string | number): AxiosPromise<RechargeRecordVO> => {
  return request({
    url: '/retail/rechargeRecord/' + id,
    method: 'get'
  });
};

/**
 * 新增充值记录
 * @param data
 */
export const checkRechargeRecord = (id: string | number | undefined, state: number|undefined, validCode: string|undefined) => {
  const data = {
    id,
    state,
    validCode
  };
  return request({
    url: '/retail/rechargeRecord/check',
    method: 'get',
    params: data
  });
};
